package com.ibl.rover.lite.common.bean;

import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;

public class ProductOrderBean extends BaseBean {

	@ColumnOrder(Order = 1)
	private String code;
	@ColumnOrder(Order = 2)
	private String productkey;
	@ColumnOrder(Order = 3)
	private String unitPrice;
	@ColumnOrder(Order = 4)
	private String quantity;
	@ColumnOrder(Order = 5)
	private String productCode;
	@ColumnOrder(Order = 6)
	private String description;
	@ColumnOrder(Order = 7)
	private String executionQuantity;
	@ColumnOrder(Order = 8)
	private String Orderkey;

	private static AutomatedQueryStatement AUTO_GEN_QUERY;

	public static final String COL_CODE = "CODE";
	public static final String COL_PRODUCT_KEY = "PRODUCT_KEY";
	public static final String COL_UNIT_PRICE = "UNIT_PRICE";
	public static final String COL_QUANTITY = "QUANTITY";
	public static final String COL_PRODUCT_CODE = "PRODUCT_CODE";
	public static final String COL_DESCRIPTION = "DESCRIPTION";
	public static final String COL_EXECUTION_QUANTITY = "EXECUTION_QUANTITY";
	public static final String COL_ORDER_KEY = "ORDERKEY";

	public static final int IDX_COL_CODE = 1;
	public static final int IDX_COL_PRODUCT_KEY = 2;
	public static final int IDX_COL_UNIT_PRICE = 3;
	public static final int IDX_COL_QUANTITY = 4;
	public static final int IDX_COL_PRODUCT_CODE = 5;
	public static final int IDX_COL_DESCRIPTION = 6;
	public static final int IDX_COL_EXECUTION_QUANTITY = 7;
	public static final int IDX_COL_ORDER_KEY = 8;

	static {
		AUTO_GEN_QUERY = SQLiteDatabaseHelper
				.getAutoGeneratedStmts(ProductOrderBean.class);
	}

	public ProductOrderBean() {

	}

	@Override
	public void bind(SQLiteStatement sqlLiteStatement) {
		sqlLiteStatement.bindString(IDX_COL_CODE, getCode());
		sqlLiteStatement.bindString(IDX_COL_PRODUCT_CODE, getProductCode());
		sqlLiteStatement.bindString(IDX_COL_UNIT_PRICE, getUnitPrice());
		sqlLiteStatement.bindString(IDX_COL_QUANTITY, getQuantity());
		sqlLiteStatement.bindString(IDX_COL_PRODUCT_KEY, getProductkey());
		sqlLiteStatement.bindString(IDX_COL_DESCRIPTION, getDescription());
		sqlLiteStatement.bindString(IDX_COL_EXECUTION_QUANTITY,
				getExecutionQuantity());
		sqlLiteStatement.bindString(IDX_COL_ORDER_KEY, getOrderkey());
	}

	@Override
	public <T extends BaseBean> T cursorBind(Cursor cursor) {
		ProductOrderBean productOrderBean = new ProductOrderBean();
		productOrderBean.set_id(cursor.getInt(IDX_COL_ID));
		productOrderBean.setCode(cursor.getString(IDX_COL_CODE));
		productOrderBean.setProductCode(cursor.getString(IDX_COL_PRODUCT_CODE));
		productOrderBean.setUnitPrice(cursor.getString(IDX_COL_UNIT_PRICE));
		productOrderBean.setQuantity(cursor.getString(IDX_COL_QUANTITY));
		productOrderBean.setProductkey(cursor.getString(IDX_COL_PRODUCT_KEY));
		productOrderBean.setDescription(cursor.getString(IDX_COL_DESCRIPTION));
		productOrderBean.setExecutionQuantity(cursor
				.getString(IDX_COL_EXECUTION_QUANTITY));
		productOrderBean.setOrderkey(cursor.getString(IDX_COL_ORDER_KEY));
		return (T) productOrderBean;
	}

	@Override
	public <T extends BaseBean> T cursorInit(Cursor cursor) {
		this.set_id(cursor.getInt(IDX_COL_ID));
		this.setCode(cursor.getString(IDX_COL_CODE));
		this.setProductCode(cursor.getString(IDX_COL_PRODUCT_CODE));
		this.setUnitPrice(cursor.getString(IDX_COL_UNIT_PRICE));
		this.setQuantity(cursor.getString(IDX_COL_QUANTITY));
		this.setProductkey(cursor.getString(IDX_COL_PRODUCT_KEY));
		this.setDescription(cursor.getString(IDX_COL_DESCRIPTION));
		this.setExecutionQuantity(cursor.getString(IDX_COL_EXECUTION_QUANTITY));
		this.setOrderkey(cursor.getString(IDX_COL_ORDER_KEY));
		return (T) this;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getProductkey() {
		return productkey;
	}

	public void setProductkey(String productkey) {
		this.productkey = productkey;
	}

	public String getUnitPrice() {
		return unitPrice;
	}

	public void setUnitPrice(String unitPrice) {
		this.unitPrice = unitPrice;
	}

	public String getQuantity() {
		return quantity;
	}

	public void setQuantity(String quantity) {
		this.quantity = quantity;
	}

	public String getProductCode() {
		return productCode;
	}

	public void setProductCode(String productCode) {
		this.productCode = productCode;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getExecutionQuantity() {
		return executionQuantity;
	}

	public void setExecutionQuantity(String executionQuantity) {
		this.executionQuantity = executionQuantity;
	}

	public String getOrderkey() {
		return Orderkey;
	}

	public void setOrderkey(String orderkey) {
		Orderkey = orderkey;
	}

	@Override
	public String getCreateTableQuery() {

		return AUTO_GEN_QUERY.getCreateTableQuery();
	}

	@Override
	public String getInsertQuery() {

		return AUTO_GEN_QUERY.getPreparedInsertQuery();
	}

	@Override
	public String getDeleteQuery() {

		return AUTO_GEN_QUERY.getPreparedDeleteQuery();
	}

	@Override
	public String getUpdateQuery() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getTableName() {

		return AUTO_GEN_QUERY.getTableName();
	}

	
		@Override
		public boolean equals(Object o) {

			if (this == o) {
				return true;
			}
			ProductBean productBean=null;
			
			if(o instanceof ProductBean){
				productBean=(ProductBean)o;
			}
			
			return false;
		}

		@Override
		public ContentValues bindContentValues() {
			// TODO Auto-generated method stub
			return null;
		}
	
	
}
